home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / system-config-printer / troubleshoot / CheckLocalServerPublishing.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-10-28  |  3KB  |  61 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import cups
  5. from timedops import TimedOperation
  6. from base import *
  7.  
  8. class CheckLocalServerPublishing(Question):
  9.     
  10.     def __init__(self, troubleshooter):
  11.         Question.__init__(self, troubleshooter, 'Is local server publishing?')
  12.         vbox = self.initial_vbox(_('Server Not Exporting Printers'), _('Although one or more printers are marked as being shared, this print server is not exporting shared printers to the network.') + '\n\n' + _("Enable the 'Publish shared printers connected to this system' option in the server settings using the printing administration tool.") + ' ' + TEXT_start_print_admin_tool)
  13.         troubleshooter.new_page(vbox, self)
  14.  
  15.     
  16.     def display(self):
  17.         self.answers = { }
  18.         cups.setServer('')
  19.         parent = self.troubleshooter.get_window()
  20.         
  21.         try:
  22.             c = self.timedop(cups.Connection, parent = parent).run()
  23.             printers = self.timedop(c.getPrinters, parent = parent).run()
  24.             if len(printers) == 0:
  25.                 return False
  26.             for name, printer in printers.iteritems():
  27.                 if printer.get('printer-is-shared', False):
  28.                     break
  29.                     continue
  30.                 len(printers) == 0
  31.             
  32.             attr = self.timedop(c.getPrinterAttributes, args = (name,), parent = parent).run()
  33.         except RuntimeError:
  34.             return False
  35.             except cups.IPPError:
  36.                 return False
  37.             elif not printer.get('printer-is-shared', False):
  38.                 return False
  39.  
  40.         if attr.get('server-is-sharing-printers', True):
  41.             return False
  42.         return True
  43.  
  44.     
  45.     def collect_answer(self):
  46.         if self.displayed:
  47.             return {
  48.                 'local_server_exporting_printers': False }
  49.         return { }
  50.  
  51.     
  52.     def cancel_operation(self):
  53.         self.op.cancel()
  54.  
  55.     
  56.     def timedop(self, *args, **kwargs):
  57.         self.op = TimedOperation(*args, **kwargs)
  58.         return self.op
  59.  
  60.  
  61.